<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/WorkspaceTemplate.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core">

    <ui:define name="top">
        
    </ui:define>

    <ui:define name="left">
    </ui:define>

    <ui:define name="right">
       
    </ui:define>

    <ui:define name="content">
        <h:form id="form1">
            <p:panel header="Edit Basic Info">
                <h3>Home Address</h3>
                <h:panelGrid columns="3">
                    <h:outputText style="font-weight: bold" value="Address Line1: *"/>
                    <p:inputText required="true" label="Address Line1" requiredMessage="Address Line1 is required."
                                 id="addressLine1" value="#{workspaceManagerBean.currentStaff.homeAddress.addressLine1}"/>
                    <p:message for="addressLine1"/>

                    <h:outputText style="font-weight: bold" value="Address Line2: "/>
                    <p:inputText required="false" label="Address Line2" requiredMessage="Address Line2 is required."
                                 id="addressLine2" value="#{workspaceManagerBean.currentStaff.homeAddress.addressLine2}"/>
                    <p:message for="addressLine2"/>

                    <h:outputText style="font-weight: bold" value="Zip Code: *"/>
                    <p:inputMask required="true" requiredMessage="Zip code is required." mask="999999"
                                 id="zipCode" value="#{workspaceManagerBean.currentStaff.homeAddress.zipCode}"/>
                    <p:message for="zipCode"/>

                    <h:outputText style="font-weight: bold" value="City: *"/>
                    <p:autoComplete id="city" forceSelection="true" required="true" requiredMessage="City is required."
                                    value="#{workspaceManagerBean.currentStaff.homeAddress.city}"   
                                    completeMethod="#{accountManagerBean.completeCity}"/>
                    <p:message for="city"/>

                    <h:outputText style="font-weight: bold" value="State Name: "/>
                    <p:inputText required="false" label="State Name" requiredMessage="State name is required."
                                 id="stateName" value="#{workspaceManagerBean.currentStaff.homeAddress.stateName}"/>
                    <p:message for="stateName"/>

                    <h:outputText style="font-weight: bold" value="Country: *"/>
                    <p:autoComplete id="country" forceSelection="true" required="true" requiredMessage="Country is required."
                                    value="#{workspaceManagerBean.currentStaff.homeAddress.country}"   
                                    completeMethod="#{accountManagerBean.completeCountry}"/>
                    <p:message for="country"/>

                </h:panelGrid>
            </p:panel>

            <p:panel>
                <h3>
                    Contact Numbers
                </h3>
                <p:messages showDetail="true"/>
                <p:dataTable id="phoneTbl" value="#{workspaceManagerBean.currentStaff.phones}" var="phone">
                    <p:column headerText="Phone Type">
                        <h:outputText value="#{phone.phoneTypeString}"/>
                    </p:column>

                    <p:column headerText="Phone Type">
                        <p:inputMask required="true" requiredMessage="Phone number is required." mask="(99)9999 9999"
                                     value="#{phone.number}"/>
                    </p:column>
                </p:dataTable>
            </p:panel>

            <p:commandButton value="Save Changes" ajax="false" actionListener="#{workspaceManagerBean.saveChanges}"/>
            <p:commandButton value="Cancel" ajax="false" action="#{workspaceManagerBean.redirectToProfilePage}"/>
        </h:form>
    </ui:define>

    <ui:define name="bottom">
       
    </ui:define>

</ui:composition>
